﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Rocket.Core;

namespace Rocket.Windows.Framework
{
    /// <summary>
    /// BaseData class derived from this class. All child User Control use customized message.
    /// That message settings and behaviours control in this class.
    /// </summary>
    public partial class BaseControl : UserControl
    {
        public BaseControl()
        {
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this._myMasterForm = this.ParentForm;
        }
        private IContainer components;


        private Form _myMasterForm;
        /// <summary>
        /// This method uses for display record Transcation result. SetMessage() method
        /// </summary>
        /// <param name="mesg"></param>
        /// <param name="type"></param>
        protected virtual void SetMessage(string mesg, MessageTypes type)
        {
            if (this._myMasterForm != null)
                ((BaseForm)this._myMasterForm).SetMessage(mesg, type);
        }

        protected virtual void SetMessage(Form Form, string mesg, MessageTypes type)
        {
            this._myMasterForm = Form;
            SetMessage(mesg, type);
        }

        protected virtual void HideMessage()
        {
            if (this._myMasterForm != null)
                ((BaseForm)this._myMasterForm).HideMessage();
        }

        protected virtual void HideMessage(Form form)
        {
            this._myMasterForm = form;
            HideMessage();
        }

        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // BaseControl
            // 
            this.BackColor = System.Drawing.SystemColors.Control;
            this.Name = "BaseControl";
            this.Padding = new System.Windows.Forms.Padding(10);
            this.Size = new System.Drawing.Size(215, 150);
            this.ResumeLayout(false);

        }
    }
}
